{extend name="Public:content"}
{block name="style"}
<style type="text/css">
.iradio_square-green{pointer-events: none;}
</style>
{/block}
{block name="content"}
<form class="form-horizontal m-t" id="thumbStatusFrom"  method="post" action='{:url("$classuri/status")}'>
    <div class="form-group">
        <label class="col-sm-2 control-label">审核状态：</label>
        <div class="col-sm-8">
            <div class="radio i-checks">
                <label style="padding-left:0"><input type="radio"  value="1" name="status"  {eq name="vo.status" value="1"}checked{/eq}/> <i></i> 通过</label>
                <label><input type="radio" value="2" name="status" {eq name="vo.status" value="2"}checked{/eq}> <i></i> 拒绝</label>
            </div>
        </div>
    </div>
    <div class="form-group reason" {neq name="vo.status" value="2"}style="display:none;"{/neq} >
        <label class="col-sm-2 control-label">拒绝理由：</label>
        <div class="col-sm-8">
            <textarea name="reason" rows="2" cols="20" class="form-control" placeholder="请填写拒绝理由，拒绝理由最多不超过50个字">{$vo.reason}</textarea>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <div class="col-sm-12 text-center">
            <input type='hidden' value='{$vo.id}' name='id'/>
            <button class="btn btn-primary" type="submit">保存数据</button>
            <button class="btn btn-primary btn-danger" type='button' data-confirm="确定要取消编辑吗？" onclick="$.Oa.confirm(this)">取消编辑</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    $('.i-checks label').click(function(){
        if($(this).find('input').val() == 2){
            $('.reason').show();
        }else{
            $('.reason').hide();
        }
    })
    //表单提交
    $('#thumbStatusFrom').validate({
        submitHandler: function(form) {
            //检查reason字数长度不超过50
            if($('textarea[name=reason]').val().length > 50){
                parent.layer.msg('理由不能超过50个字');
                return false;
            }
            $.Oa.doHform('#thumbStatusFrom',false,false,function(data){
                parent.layer.msg(data.msg);
                var iframe ='{$iframe}';
                var n = parent.$("iframe[name='"+iframe+"']").index();
                parent[n].$('#thumb_table').bootstrapTable('refresh');
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            })
        }
    })
</script>
{/block}

